<?php
declare(strict_types=1);


namespace App\Library\Notify;


use Guanguans\Notify\Factory;
use Guanguans\Notify\Messages\DingTalk\TextMessage;
use Illuminate\Support\Facades\App;

class DingTalk
{
    /**
     * 钉钉发送消息
     * @param $message
     * @param array $atMobiles
     */
    public static function send($message, array $atMobiles = [])
    {
        $token = 'de35d6e4ce12dd91b05b81dc96676f43937dc99da6d95ac71b171806905e126f';
        $secret = 'SEC663908cb6f50bc1136f73b269bcbbe687f44f1803d60f418ea17796285be98e4';
        $environment = App::environment();
        Factory::dingTalk()->setToken($token)->setSecret($secret)->send((new TextMessage([
            'content' => 'pro-third-api:' . $environment . PHP_EOL . $message,
            'atMobiles' => $atMobiles,
        ])));
    }
}
